//@author A0005591J
#ifndef SEARCH_H
#define SEARCH_H

#include <cstring>
#include <cstdlib>
#include "XpensItem.h"
#include "PaymentItem.h"
#include"SearchSpec.h"

using namespace std;

class Search{
private:
	vector <streampos> addressList;
	string filename;
public:
	Search();
	void SearchFile(string);
	streampos internalSearch(Item&, Item&);
	//pre: input an object of abstract class Item
	//pos: search in the two Data files
	
	double Day_total_CF(string Date, Item&);// search for the total cash flow today

	void SearchKeyword(string, Item&);//simple search

	double Month_total_CF( int,int,Item& );//search for the total cash flow this month until today

	bool powerSearch();

	bool Print(Item&);

	streampos getAddress(int);
	//pre: input a postion needed
	//post: output the corresponding address of the required position in the list

	void getItem(int, Item&);
	string convert_lower(string str);
	int numOfItems();
};

#endif